package com.lg.java.jmm;

/**
 * 常量 常量池
 */
public class FinalTest {
    final int aa = 1;
    final int bb;

    FinalTest(int num) {
        this.bb = num;
    }

    public static void main(String[] args) {
        int n1 = 2019;          //普通变量
        final int n2 = 2019;    //final修饰的变量


        String s = "20190522";
        String s1 = n1 + "0522";	//拼接字符串"20190512"
        String s2 = n2 + "0522";
        String s3 = new String("20190522");
        String s4 = 2019 + "0522";
        System.out.println(s == s1);	//false
        System.out.println(s == s2);	//true
        System.out.println(s == s3);    //false s3相当于s1
        System.out.println(s == s4);    // true

        s4.intern();
    }

    private  static  void  say() {
        final int aa = 1;
        System.out.println(aa);
    }
}
